<template>
  <div>
    <el-dialog title="指派司机" :visible.sync="dialogVisible">
      <el-form ref="form" :model="form" :rules="rules">
        <el-form-item label="司机" :label-width="formLabelWidth" prop="driver_id">
          <el-select v-model="form.driver_id" placeholder="请选择司机">
            <el-option
              v-for="item in driverList"
              :key="item.id"
              :label="item.user_name"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <!-- <el-button @click="dialogVisible = false">取 消</el-button> -->
        <el-button type="primary" @click="submitFun('form')">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dialogVisible: false,
      form: {
        driver_id: '',
        order_num: ''
      },
      driverList: [],
      rules: {
        driver_id: [
          { required: true, message: '请选择司机', trigger: 'change' }
        ]
      },
      formLabelWidth: '120px'
    }
  },
  created() {
  },
  methods: {
    submitFun(formname) {
      this.$refs[formname].validate((valid) => {
        if (valid) {
          this.$emit('acceptFun', this.form)
          this.dialogVisible = false
        }
      })
    }
  }

}
</script>

<style lang="scss" scoped>
.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
  .red {
    color: red;
  }
  .span {
    color: #ccc;
    font-size: 12px;
  }
</style>
